<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box1 {
            width: 100px;
            height: 100px;
            background-color: red;

            float: left;
        }


        /* 清除浮动的影响
        clear清除浮动元素的影响：
        可选值：
        none 不清除 默认值
        left 清除元素float:left的影响 
        right 清除元素float:right的影响
        both 清除元素left与right浮动的影响 */
        .box2 {
            width: 100px;
            height: 100px;
            background-color: green;
            float: right;


        }

        .box3 {
            width: 100px;
            height: 100px;
            background-color: blue;
            clear: both;

        }
    </style>
</head>

<body>
    <div class="box1">1</div>
    <div class="box2">2</div>
    <div class="box3">3</div>

</body>

</html>